#!/bin/bash

# ***************************************************************************
# * 
# * @file:build.sh 
# * @author:ebayboy@163.com 
# * @date:2019-11-26 22:59 
# * @version 1.0  
# * @description: Shell script 
# * @Copyright (c)  all right reserved 
#* 
#**************************************************************************/ 

#上一级目录名称
PRE_PATH=$(dirname "$PWD")

rm build -rf && mkdir build && cd build

cmake ../ -DCMAKE_INSTALL_PREFIX=./	\
	-DJANSSON_LIBRARY=$PRE_PATH/lib \
	-DJANSSON_INCLUDE_DIR=$PRE_PATH/include || exit 1

make install

echo "cp -af lib/*.a $PRE_PATH/lib"
cp -af lib/*.a $PRE_PATH/lib && ls $PRE_PATH/lib

echo "cp -af include/*.h $PRE_PATH/include/"
cp -af include/*.h $PRE_PATH/include/ && ls $PRE_PATH/include

cd - 

exit 0
